﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Gizmox.WebGUI.Common.Resources;
using Gizmox.WebGUI.Forms;

namespace TVC
{
    [Serializable()]
    public class LogicalCategoryNode : CategoryNode
    {
        private TreeNodeCollection mobjNodes = null;
        private TreeNode mobjNode = null;

        public LogicalCategoryNode(CategoryNode objParent, TreeNodeCollection objParebtNodes, string strLabel, string module, string address, string language)
            : this(objParent, objParebtNodes, strLabel, module, "Folders.gif", address, language)
        {
        }

        public LogicalCategoryNode(CategoryNode objParent, TreeNodeCollection objParebtNodes, string strLabel, string module, string strIcon, string address, string language)
            : base(objParent, strLabel, address, language)
        {
            mobjNode = new TreeNode(strLabel);
            mobjNode.Name = module;
            mobjNode.Text = clsConfigurarion.GetLabel(address, "", strLabel, language);
            Address = address;
            Language = language;
            //objTab.Name = Address;
            mobjNode.Image = new IconResourceHandle(strIcon);
            //mobjNode.ExpandedImage = new IconResourceHandle("Interface.gif");
            mobjNode.Tag = this;
            mobjNode.IsExpanded = false;
            objParebtNodes.Add(mobjNode);
            mobjNodes = mobjNode.Nodes;
        }

        public override Control GetCategoryInstance(MainForm main = null)
        {
            return null;// new Categories.LogicalCategory(this);
        }

        public override TreeNodeCollection Nodes
        {
            get
            {
                return mobjNodes;
            }
        }

        public override void SetDefault()
        {
            mobjNode.TreeView.SelectedNode = mobjNode;
            Expand(mobjNode);
        }

        public override string Text
        {
            get
            {
                return mobjNode == null ? "Node" : mobjNode.Text;
            }
        }
    }
}
